<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.trkj.com/tr1702/tags" prefix="my" %>
<html>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>培训课程安排</title>
	<style type="text/css">
		 
	</style>
</head>
<body>	
	<script type="text/javascript">
			var editdialog =function(){
				<my:g id="93"> 
				$("<form method='get'>").appendTo(document.body).form({
					url:'Coursearrangement_update',
					onSubmit:function(param){
						var vv=	$('#cf-Coursearrangement-tb').datagrid('getSelected');
						var ff=$("#cf-Coursearrangement-sid").textbox('getValue');
							param['courseaId'] =vv.courseaId;
							param['stainId'] = vv.stainId//$("#cf-Coursearrangement-sid").textbox('getValue');
							param['stainName'] =vv.stainName//$("#cf-Coursearrangement-sname").textbox('getValue');
							param['trainingId'] =vv.trainingId//$("#cf-Coursearrangement-tds").textbox('getValue');
							param['trainingName'] =vv.trainingName//$("cf-Coursearrangement-tname").textbox('getValue');
							param['courseaQualifiedscore'] =$("#cf-Coursearrangement-Qualifiedscore").textbox('getValue');
							param['courseaTestscores'] =$("#cf-Coursearrangement-Testscores").textbox('getValue');
							param['courseaMakeup'] =$("#cf-Coursearrangement-Makeup").textbox('getValue');
							param['courseaState'] =$("#cf-Coursearrangement-State").textbox('getValue');
							 
					},
					success:function(){
						$('#cf-Coursearrangement-tb').datagrid('reload');
						$('#cf-Coursearrangement-win').dialog('close');
					}
				}).submit().appendTo(".abc");
				</my:g> 
			}
			var formatters =function(value,row,index){
				<my:g id="92"> 
				var del ="<a butn='cf_del' onclick='delrow("+row.courseaId+")'></a>";
				</my:g> 
					return del;
			} 
			var delrow =function(courseaId){
				$.messager.confirm('提示','确定删除该项',function(v){
					if(v){
						$.post('Coursearrangement_remove',{courseaId:courseaId},function(){
							$('#cf-Coursearrangement-tb').datagrid('reload');
						});
					}
				});
			}
			$(function(){
				$("#cf-Coursearrangement-tb").datagrid({onLoadSuccess: function(){
					//$("a[butn=tb_btn_edit]").linkbutton({iconCls:'icon-edit', plain:true});
					$("a[butn=cf_del]").linkbutton({iconCls:'icon-cancel', plain:true});
				}});
				//打开新增界面
				$("#cf-Coursearrangement-add").linkbutton({
					onClick : function() {
						 $("#cf-Coursearrangement-win").dialog("open");
						 	$('#cf-Coursearrangement-cid').textbox('setValue','');
							$('#cf-Coursearrangement-sid').textbox('setValue','');
							$('#cf-Coursearrangement-sname').textbox('setValue','');
							$('#cf-Coursearrangement-tds').textbox('setValue','');
							$('#cf-Coursearrangement-tname').textbox('setValue','');
							$('#cf-Coursearrangement-Qualifiedscore').textbox('setValue','');
							$('#cf-Coursearrangement-Testscores').textbox('setValue','');
							//$('#cf-Coursearrangement-Makeup').textbox('setValue','');
							//$('#cf-Coursearrangement-State').textbox('setValue',''); cf-Coursearrangement-refresh
							/* parent.$('.dialog-button a:eq(0)').show();
							parent.$('.dialog-button a:eq(1)').hide(); */
							$('#cf-pxkcap-1').show();
							$('#cf-pxkcap-2').hide();
							$('#cf-pxkcap-3').hide();
					}
				});
				
				$("#cf-Coursearrangement-refresh").linkbutton({
					onClick : function() {
						$('#cf-Coursearrangement-tb').datagrid('reload');
					}
				});
				/* $("#cf-Coursearrangement-query-tb").datagrid({onDblClickRow:function(){
					var vv=$('#cf-Coursearrangement-query-tb').datagrid('getSelected');	
					$('#cf-Coursearrangement-sid').textbox('setValue',vv.stainId);
					$('#cf-Coursearrangement-sname').textbox('setValue',vv.stainName);
					$('#cf-Coursearrangement-query-win').dialog('close');
					
				}});
				$("#cf-Coursearrangement-query-tb").datagrid({onDblClickRow:function(){
					var vv=$('#cf-Coursearrangement-query-tb').datagrid('getSelected');	
					$('#cf-Coursearrangement-tds').textbox('setValue',vv.trainingId);
					$('#cf-Coursearrangement-tname').textbox('setValue',vv.trainingName);
					$('#cf-Coursearrangement-query-win').dialog('close');
				}}); */
				$("#cf-Coursearrangement-tb").datagrid({onDblClickRow:function(){
					$('#cf-Coursearrangement-win').dialog('open');
					var vv=	$('#cf-Coursearrangement-tb').datagrid('getSelected');	
					$('#cf-Coursearrangement-cid').textbox('setValue',vv.courseaId);
					$('#cf-Coursearrangement-sid').textbox('setValue',vv.stainId);
					$('#cf-Coursearrangement-sname').textbox('setValue',vv.stainName);
					$('#cf-Coursearrangement-tds').textbox('setValue',vv.trainingId);
					$('#cf-Coursearrangement-tname').textbox('setValue',vv.trainingName);
					$('#cf-Coursearrangement-Qualifiedscore').textbox('setValue',vv.courseaQualifiedscore);
					$('#cf-Coursearrangement-Testscores').textbox('setValue',vv.courseaTestscores);
				//	$('#cf-Coursearrangement-Makeup').textbox('setText',vv.courseaMakeup);
					//$('#cf-Coursearrangement-State').textbox('setText',vv.courseaState); 
					/* parent.$('.dialog-button a:eq(0)').hide();
					parent.$('.dialog-button a:eq(1)').show(); */
					$('#cf-pxkcap-3').show();
					$('#cf-pxkcap-2').show();
					$('#cf-pxkcap-1').hide();
				}});
				$("#cf-ygtj-add").linkbutton({
					onClick : function() {
						var vvv= $('#dialog-qd-1').text();
						//alert(vvv);
						 $("#cf-Coursearrangement-query-win").dialog("open");
						 $('#sbox').searchbox('label','员工名称');
						$('#cf-Coursearrangement-query-tb').datagrid('showColumn','stainId');
						$('#cf-Coursearrangement-query-tb').datagrid('showColumn','stainName');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'courseaId');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'trainingId');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'trainingName');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'courseaQualifiedscore');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'courseaTestscores');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'courseaMakeup');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', 'courseaState');
						 $("#cf-Coursearrangement-query-tb").datagrid('hideColumn', '9');
						 /* $('#dialog-qd-1').show();
						 $('#dialog-qd-2').hide(); */
					}
				});
				$("#cf-hdtj-add").linkbutton({
					onClick : function() {
						 $("#cf-Coursearrangement-query-win1").dialog("open");
						  $('#sbox1').searchbox('label','活动名称');
						  $('#cf-Coursearrangement-query-tb1').datagrid('showColumn','trainingId');
						 $('#cf-Coursearrangement-query-tb1').datagrid('showColumn','trainingName');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'stainId');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'stainName');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'courseaId');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'courseaQualifiedscore');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'courseaTestscores');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'courseaMakeup');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', 'courseaState');
						 $("#cf-Coursearrangement-query-tb1").datagrid('hideColumn', '9'); 
						 //parent.$('.dialog-button a:eq(0)').hide();
						 /* $('#dialog-qd-1').hide();
						 $('#dialog-qd-2').show(); */
					}
				});
			});
	</script>
	<div class="abc"></div>
	<div id="cf-Coursearrangement-tbs1">
		<my:g id="91"> 
		<a id="cf-Coursearrangement-add" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a>
    	 </my:g>
		<a id="cf-Coursearrangement-refresh" class="easyui-linkbutton" data-options="iconCls:'icon-reload',text:'刷新',plain:true,iconAlign:'right'"></a>
    	 <input  class="easyui-searchbox" data-options="label:'搜索',width:300,labelWidth:50,
     	searcher:function(value,name){
	        $('#cf-Coursearrangement-tb').datagrid('load','Coursearrangement_searchbox?stainName='+value);
     	 },disabled:'false'">
		<!-- <a id="train_course_arrange" class="easyui-linkbutton" data-options="text:'选择'"></a> -->
  	</div>
		<table id="cf-Coursearrangement-tb" class="easyui-datagrid" data-options="
			url:'Coursearrangement_pages',
			fitColumns:true,
			fit:true,
			nowrap:false,
			loading:true,
			pagination:true,
			rownumbers:true,
			singleSelect:true,
			pageSize:10,
    		pageList:[10,20,30,40,50],
			toolbar:'#cf-Coursearrangement-tbs1',
			striped:true,
			method:'get'	
	">
	<thead>
		  <tr>
			<th id="cf-cid" data-options="field:'courseaId',width:200,align:'center'">培训课程安排Id</th>
			<th id="cf-sid" data-options="field:'stainId',width:300,align:'center'">员工编号</th>
			<th id="cf-sname" data-options="field:'stainName',width:200,align:'center',
				styler:function(value,row,index){
					if(value==1){
						return 'color:white;background:red;';
					}
				}
			">员工名称</th>
			<th id="cf-tid" data-options="field:'trainingId',width:300,align:'center'">活动编号</th>
			<th id="cf-tname" data-options="field:'trainingName',width:250,align:'center'">活动名称</th>
			<th id="cf-ksfs" data-options="field:'courseaTestscores',width:200,align:'center'">考试分数</th>
			<th id="cf-hgfs" data-options="field:'courseaQualifiedscore',width:200,align:'center'">合格分数</th>
			<th id="cf-bk" data-options="field:'courseaMakeup',width:200,align:'center',
			formatter:function(value){
					if(value==0){
						return value='否';
					}else{return value='是';}
			}">补考</th>
			<th id="cf-zt" data-options="field:'courseaState',width:200,align:'center',
			formatter:function(value,row,index){
					if(value==0){
						return value='O';
					}else{
					$('#cf-Coursearrangement-tb').datagrid('freezeRow',row.courseaId);
					return value='X';}
			},styler:function(value,row,index){
					if(value==1){
						return 'color:red;';
					}else{return 'color:#000000';}
				}">状态</th>
			<th id="cf-id" data-options="field:'9',width:200,align:'center',formatter:formatters">操作</th>
		  </tr>	
		</thead>
		<tbody>
			 
		</tbody>
	</table>
	 <div id="cf-Coursearrangement-win" class="easyui-dialog"data-options="width:700, height:350,
			title:'培训课程安排',
     		bodyCls:'Coursearrangement_add',
      		modal:true,
      		closed:true,
      		buttons:[{
	        	text:'添加',
				id:'cf-pxkcap-1',
	        	iconCls:'icon-ok',
        		handler:function(){
          		 $('#cf-Coursearrangement-f').form({
            		onSubmit:function(param){
            		 //验证表单
						//var cc=$('#cf-Coursearrangement-name').textbox('getValue');
             		 return $(this).form('validate');
            		},
	           		 success:function(v){
	              		//$.messager.alert('提示','注册成功');
	              		$('#cf-Coursearrangement-win').dialog('close');
						$('#cf-Coursearrangement-tb').datagrid('reload');
	            	}
          	    }).submit();
       		  }
      		},{
	        	text:'修改',
				id:'cf-pxkcap-2',
	        	iconCls:'icon-edit',
		        	handler:editdialog 
				},{
	        	text:'清除',
				id:'cf-pxkcap-3',
	        	iconCls:'icon-cancel',
		        	handler:function(){
		          		$('#cf-Coursearrangement-f').form('clear');
		        	}
				},{
	        	text:'取消',
	        	iconCls:'icon-cancel',
		        	handler:function(){
		          		$('#cf-Coursearrangement-win').dialog('close');
		        	}
				}
			]">
		<form id="cf-Coursearrangement-f" action="Coursearrangement_add" method="get">
				<div style="float:left;margin-top:20px">
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-cid" class="easyui-textbox" name="courseaId"
							data-options="label:'培训课程安排编号',width:250">
					</div>
					
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-sid" class="easyui-textbox" name="stainId"
							data-options="label:'员工编号',width:220,editable:false,required:true">
							<a id="cf-ygtj-add" date-value='1'; class="easyui-linkbutton" data-options="iconCls:'icon-man',plain:true "></a>
					</div>
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-sname" class="easyui-textbox" name="stainName"
							data-options="label:'员工名称',width:250,editable:false,required:true">
					</div>
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-tds" class="easyui-textbox" name="trainingId"
							data-options="label:'活动编号',width:220,editable:false,required:true">
						<a id="cf-hdtj-add" date-value='2'; class="easyui-linkbutton" data-options="iconCls:'icon-man',plain:true "></a>	
					</div>
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-tname" class="easyui-textbox" name="trainingName"
							data-options="label:'活动名称',width:250,editable:false,required:true">
					</div>
				</div>
				<div style="float:right;margin-right:90px;margin-top:20px">
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-Testscores" class="easyui-textbox" name="courseaTestscores"
							data-options="label:'考试分数',width:250">
					</div>
					<div class="line" style="margin-top:10px">
						        <input id="cf-Coursearrangement-Qualifiedscore" class="easyui-textbox" name="courseaQualifiedscore"
							data-options="label:'合格分数',width:250">
					</div>
					<div class="line" style="margin-top:10px;margin-left:35px">
							<select id="cf-Coursearrangement-Makeup" class="easyui-combobox" name="courseaMakeup"
							 data-options="label:'是否补考',width:200,panelHeight:'auto',editable:false">   
							    <option value="0">否</option>   
							    <option value="1">是</option>   
							</select>
					</div>
					<div class="line" style="margin-top:10px;margin-left:35px">
							<select id="cf-Coursearrangement-State" class="easyui-combobox" name="courseaState"
							 data-options="label:'状态',width:200,panelHeight:'auto',editable:false">   
							    <option value="0">可用</option>   
							    <option value="1">不可用</option>   
							</select>
					</div>
				</div>		
		</form>
	</div>
	<div id="cf-Coursearrangement-query-tbs1">
    	 <input id="sbox" style="margin-left:80px" class="easyui-searchbox" data-options="label:'名称查找',width:300,labelWidth:50,
     	searcher:function(value,name){
	        $('#cf-Coursearrangement-query-tb').datagrid('load','Coursearrangement_query_searchbox?stainName='+value);
     	 },disabled:'false'">
  	</div>
	 <div id="cf-Coursearrangement-query-win" class="easyui-dialog"data-options="width:490, height:300,
			title:'清单查找-员工',
     		bodyCls:'Coursearrangement_yg',
      		modal:true,
      		closed:true,
      		buttons:[{
				id:'dialog-qd-1',
	        	text:'确定',
	        	iconCls:'icon-ok',
        		handler:function(){
					var vv=$('#cf-Coursearrangement-query-tb').datagrid('getSelected');	
					//alert(vv.trainingId);
					if(vv!=null){
						$('#cf-Coursearrangement-sid').textbox('setValue',vv.stainId);
						$('#cf-Coursearrangement-sname').textbox('setValue',vv.stainName);
          		 		$('#cf-Coursearrangement-query-win').dialog('close');
					}else{
						$.messager.alert('提示','请选择一行');
					}
				 
       		    }
      		},{
	        	text:'取消',
	        	iconCls:'icon-cancel',
		        	handler:function(){
		          		$('#cf-Coursearrangement-query-win').dialog('close');
		        	}
				}
			]">
			 
				 <table id="cf-Coursearrangement-query-tb" class="easyui-datagrid" data-options="
					url:'Coursearrangement_yg',
					fitColumns:true,
					fit:true,
					nowrap:false,
					loading:true,
					pagination:false,
					rownumbers:false,
					singleSelect:true,
					pageSize:10,
		    		pageList:[10,20,30,40,50],
					toolbar:'#cf-Coursearrangement-query-tbs1',
					striped:true,
					method:'get'	
			">
			<thead>
				  <tr>
					 	<th data-options="field:'courseaId',width:200,align:'center'">培训课程安排Id</th>
						<th data-options="field:'stainId',width:300,align:'center'">员工编号</th>
						<th data-options="field:'stainName',width:200,align:'center'">员工名称</th>
						<th data-options="field:'trainingId',width:300,align:'center'">活动编号</th>
						<th data-options="field:'trainingName',width:250,align:'center'">活动名称</th>
					<!-- <th data-options="field:'3',width:300,align:'center'">课程编号</th>
						<th data-options="field:'4',width:200,align:'center'">课程名称</th> 
						<th data-options="field:'courseaQualifiedscore',width:200,align:'center'">考试分数</th>
						<th data-options="field:'courseaTestscores',width:200,align:'center'">合格分数</th>
						<th data-options="field:'courseaMakeup',width:200,align:'center'">补考</th>
						<th data-options="field:'courseaState',width:200,align:'center'">状态</th>
						<th data-options="field:'9',width:200,align:'center'"></th>-->
				</thead>
					<tbody>
					 
					</tbody>
				</table>
			 
	</div>
	<div id="cf-Coursearrangement-query-tbs11">
    	 <input id="sbox1" style="margin-left:80px" class="easyui-searchbox" data-options="label:'名称查找',width:300,labelWidth:50,
     	searcher:function(value,name){
	        $('#cf-Coursearrangement-query-tb').datagrid('load','Coursearrangement_query_searchbox?stainName='+value);
     	 },disabled:'false'">
  	</div>
	 <div id="cf-Coursearrangement-query-win1" class="easyui-dialog"data-options="width:490, height:300,
			title:'清单查找-员工',
     		bodyCls:'Traininggactivity_pages',
      		modal:true,
      		closed:true,
      		buttons:[{
				id:'dialog-qd-2',
	        	text:'确定',
	        	iconCls:'icon-ok',
		        	handler:function(){
				var vv=$('#cf-Coursearrangement-query-tb1').datagrid('getSelected');	
				//alert(vv.trainingId);
					if(vv!=null){
						$('#cf-Coursearrangement-tds').textbox('setValue',vv.trainingId);
						$('#cf-Coursearrangement-tname').textbox('setValue',vv.trainingName);
          		 		$('#cf-Coursearrangement-query-win1').dialog('close');
					}else{
						$.messager.alert('提示','请选择一行');
					}
		        	}
				},{
	        	text:'取消',
	        	iconCls:'icon-cancel',
		        	handler:function(){
		          		$('#cf-Coursearrangement-query-win1').dialog('close');
		        	}
				}
			]">
			 
				 <table id="cf-Coursearrangement-query-tb1" class="easyui-datagrid" data-options="
					url:'Traininggactivity_pages',
					fitColumns:true,
					fit:true,
					nowrap:false,
					loading:true,
					pagination:true,
					rownumbers:false,
					singleSelect:true,
					pageSize:10,
		    		pageList:[10,20,30,40,50],
					toolbar:'#cf-Coursearrangement-query-tbs11',
					striped:true,
					method:'get'	
			">
			<thead>
				  <tr>
					 	<th data-options="field:'courseaId',width:200,align:'center'">培训课程安排Id</th>
						<th data-options="field:'stainId',width:300,align:'center'">员工编号</th>
						<th data-options="field:'stainName',width:200,align:'center'">员工名称</th>
						<th data-options="field:'trainingId',width:300,align:'center'">活动编号</th>
						<th data-options="field:'trainingName',width:250,align:'center'">活动名称</th>
				</thead>
					<tbody>
					 
					</tbody>
				</table>
			 
	</div>
</body>
</html>